package com.tedu.bill;

import java.util.Scanner;

/**
 * Author：毕龙
 * Date: 2024/3/24 10:41
 */
public class TestBank {
    public static void main(String[] args) {
        //银行ATM取款机
        System.out.println("******************************************");
        System.out.println("***********欢迎来带建设引号ATM取款机********");
        System.out.println("******************************************");
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入用户名：");
        String username = sc.next();
        System.out.println("请输入密码：");
        String password = sc.next();
        if (username.equals("朱琳")) {
            if (password.equals("123456")) {
                //声明一个变量 判断是否继续
                char continueFlag = ' ';
                do{
                    System.out.println("******************************************");
                    System.out.println("***********       欢迎:" + username + "     ********");
                    System.out.println("******************************************");
                    System.out.println("1.修改密码  2.存款  3.取款  4.转账  5.退出");
                    System.out.println("请输入您的选择：");
                    int select = sc.nextInt();
                    switch (select) {
                        case 1:
                            System.out.println("请输入原密码：");
                            String oldPass = sc.next();
                            if(password.equals(oldPass)){
                                System.out.println("请输入新密码：");
                                String newPass = sc.next();
                                System.out.println("请再次输入新密码：");
                                String surePass = sc.next();
                                if(newPass.equals(surePass)){
                                    System.out.println("修改密码成功！");
                                }else{
                                    System.out.println("两次输入密码不一致，修改密码失败！！");
                                }
                            }else{
                                System.out.println("原密码不正确！！！");
                            }
                            break;
                        case 2:
                            System.out.println("存款成功！");
                            break;
                        case 3:
                            System.out.println("取款成功！");
                            break;
                        case 4:
                            System.out.println("转账成功！");
                            break;
                        case 5:
                            //退出
                            System.out.println("欢迎下次光临！！！");
                            System.exit(0);
                            break;
                        default:
                            System.out.println("选择错误！！！");
                    }
                    System.out.println("请确认是否继续操作：");
                    System.out.println("y表示确认，n表示退出");
                    continueFlag = sc.next().charAt(0);
                }while(continueFlag == 'y');
            } else {
                System.out.println("密码错误");
            }
        } else {
            System.out.println("用户错误！！");
        }
    }
}
